import 'package:flutter_test/flutter_test.dart';
import 'package:foreground_service/foreground_service.dart';
import 'package:foreground_service/foreground_service_platform_interface.dart';
import 'package:foreground_service/foreground_service_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockForegroundServicePlatform
    with MockPlatformInterfaceMixin
    implements ForegroundServicePlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');
}

void main() {
  final ForegroundServicePlatform initialPlatform = ForegroundServicePlatform.instance;

  test('$MethodChannelForegroundService is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelForegroundService>());
  });

  test('getPlatformVersion', () async {
    ForegroundService foregroundServicePlugin = ForegroundService();
    MockForegroundServicePlatform fakePlatform = MockForegroundServicePlatform();
    ForegroundServicePlatform.instance = fakePlatform;

    expect(await foregroundServicePlugin.getPlatformVersion(), '42');
  });
}
